<script type="text/javascript">
	$("#tablesorter").tablesorter({
		widgets: ['zebra']
	});
</script>

<table id="tablesorter" class="tablesorter">
  <thead>
    <tr>
      <?php if (!$tp_saida_excel) : ?>
		<th></th>
	  <?php endif; ?>	
	  
      <th>Ação</th>
      <th>Proposição</th>
	  <?php if ($sf_user->getAttribute('gerente',null,'usr')) : ?>
	    <th>Usuário</th>
	  <?php endif; ?>
      <th>Descrição</th>
      <th>Limite conclusão</th>
      <th>Conclusão</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($acao_list as $i => $acao): ?>
        <?php if($acao->getDtConclusao() <> ""): //está concluído?
		  $flag = "blue";
		elseif(strtotime($acao->getDtLimiteConclusao()) < strtotime('-1 day')) : //se não: venceu?
		    $flag = "red";
 		  elseif(strtotime($acao->getDtLimiteConclusao()) < strtotime('+2 day')): //se não: falta 3 dias?
		      $flag = "yellow";
	 	    else:
		      $flag = "green";
		endif; ?>	
	    <tr>
		  <?php if (!$tp_saida_excel) : ?>
			<td><a href="<?php echo url_for('acao/show?cd_acao='.$acao->getCdAcao()) ?>"><?php echo image_tag('flags/'.$flag.'.gif') ?></a></td>
	        <td><?php echo link_to($acao->getName(), 'acao/show?cd_acao='.$acao->getCdAcao()) ?></td>
		  <?php else : ?>	
	        <td><?php echo $acao->getName() ?></td>
		  <?php endif; ?>	

	      <td><?php echo $acao->getProposicao() ?></td>
		  <?php if ($sf_user->getAttribute('gerente',null,'usr')) : ?>
	        <td><?php echo $acao->Proposicao->Camara->Usuario->name ?></td>
		  <?php endif; ?>
	      <td><?php echo $acao->getDeAcao() ?></td>
	      <td><?php echo date('d/m/Y', strtotime($acao->getDtLimiteConclusao())) ?></td>
	      <td><?php echo $acao->getDtConclusao() ? date('H:i d/m/Y', strtotime($acao->getDtConclusao())) : '' ?></td>
	    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
